enum-as-inner
A deriving proc-macro for generating functions to automatically give access to the inner members of enum.
Basic unnamed field case
The basic case is meant for single item enums, like:
extern crate enum_as_inner;
where the inner item can be retrieved with the as_*()
function:
let one = One;
assert_eq!;
the result is always a reference for inner items.
Unit case
This will return copy's of the value of the unit variant, as isize
:
extern crate enum_as_inner;
These are not references:
let unit = Two;
assert_eq!;
Mutliple, unnamed field case
This will return a tuple of the inner types:
extern crate enum_as_inner;
And can be accessed like:
let many = Three;
assert_eq!;
Multiple, named field case
This will return a tuple of the inner types, like the unnamed option:
extern crate enum_as_inner;
And can be accessed like:
let many = Three;
assert_eq!;